# -*- coding: utf-8 -*-

"""
DateTime   : 2020/12/17 15:49
Author     : ZhangYafei
Description: 被装饰函数带有指定个数参数
"""
import time


def record_time(func):
    def wrapper(a, b):
        start_time = time.time()
        func(a, b)
        end_time = time.time()
        print('spend is {}'.format(end_time - start_time))

    return wrapper


@record_time       # 得到闭包函数record_time, add = record_time(add)
def add(a, b):
    print(a + b)
    time.sleep(1)


add(3, 4)
"""
7
spend is 1.0194220542907715
"""